import request from '@/utils/request'
import qs from 'qs'

export function getFormLayoutPageList(data) {
  return request({
    url: 'formLayout/getFormLayoutPageList',
    method: 'post',
    data
  })
}
export function addFormTemplate(data) {
  return request({
    url: 'formLayout/addFormTemplate',
    method: 'post',
    data
  })
}
export function getClassificationList(data) {
  return request({
    url: 'formLayout/getClassificationList',
    method: 'post',
    data
  })
}
export function deleteFormTemplate(data) {
  return request({
    url: 'formLayout/deleteFormTemplate',
    method: 'post',
    data
  })
}
export function editFormTemplate(data) {
  return request({
    url: 'formLayout/editFormTemplate',
    method: 'post',
    data
  })
}
export function editFormLayout(data) {
  return request({
    url: 'formLayout/editFormLayout',
    method: 'post',
    data
  })
}
export function getFormPropertyDefinitionList(data) {
  return request({
    url: 'formPropertyDefinition/getFormPropertyDefinitionList',
    method: 'post',
    data
  })
}
export function getOneFormLayout(data) {
  return request({
    url: 'formLayout/getOneFormLayout',
    method: 'post',
    data
  })
}
export function matchSingleInstanceWithProperties(data) {
  return request({
    url: 'formProperty/matchSingleInstanceWithProperties',
    method: 'post',
    data
  })
}
export function getFormPropertyDefinitionPageList(data) {
  return request({
    url: 'formPropertyDefinition/getFormPropertyDefinitionPageList',
    method: 'post',
    data
  })
}
export function editFormPropertyDefinition(data) {
  return request({
    url: 'formPropertyDefinition/editFormPropertyDefinition',
    method: 'post',
    data
  })
}
export function addFormPropertyDefinition(data) {
  return request({
    url: 'formPropertyDefinition/addFormPropertyDefinition',
    method: 'post',
    data
  })
}
export function batchDeleteFormPropertyDefinition(data) {
  return request({
    url: 'formPropertyDefinition/deleteFormPropertyDefinition',
    method: 'post',
    data
  })
}

// 获取所有表单
export function getAllFormLayout(data) {
  return request({
    url: 'formLayout/getAllFormLayout',
    method: 'post',
    data
  })
}
// 获取搜索模式下拉框列表
export function getSearchModeOptionList(data) {
  return request({
    url: '/formComponentSearchConfig/getSearchModeOptionList',
    method: 'get',
    data
  })
}
// 根据布局id获取表单组件搜索配置
export function getFormComponentSearchConfigByLayoutId(params) {
  return request({
    url: '/formComponentSearchConfig/getFormComponentSearchConfigByLayoutId',
    method: 'post',
    transformRequest: [(data) => qs.stringify(data)],
    data: params
  })
}
// 新增或修改表单组件搜索配置
export function addOrUpdateFormComponentSearchConfig(data) {
  return request({
    url: '/formComponentSearchConfig/addOrUpdate',
    method: 'post',
    data
  })
}
// 获取单个表单布局
export function getOneSearchFormLayout(params) {
  return request({
    url: '/formComponentSearchConfig/getOneFormLayout',
    method: 'post',
    transformRequest: [(data) => qs.stringify(data)],
    data: params
  })
}
// 监控台表单设计器高级搜索
export function getSearchData(params) {
  return request({
    url: '/formComponentSearchConfig/search',
    method: 'post',
    data: params
  })
}
